package org.hl7.fhir.r4b.model;

/*
  Copyright (c) 2011+, HL7, Inc.
  All rights reserved.
  
  Redistribution and use in source and binary forms, with or without modification, \
  are permitted provided that the following conditions are met:
  
   * Redistributions of source code must retain the above copyright notice, this \
     list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above copyright notice, \
     this list of conditions and the following disclaimer in the documentation \
     and/or other materials provided with the distribution.
   * Neither the name of HL7 nor the names of its contributors may be used to 
     endorse or promote products derived from this software without specific 
     prior written permission.
  
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
  POSSIBILITY OF SUCH DAMAGE.
  */

// Generated on Mon, Jun 13, 2022 17:19+0300 for FHIR v4.3.0

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.r4b.model.Enumerations.*;
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.ICompositeType;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.ChildOrder;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Block;

/**
 * A list is a curated collection of resources.
 */
@ResourceDef(name = "List", profile = "http://hl7.org/fhir/StructureDefinition/List")
public class ListResource extends DomainResource {

  public enum ListStatus {
    /**
     * The list is considered to be an active part of the patient's record.
     */
    CURRENT,
    /**
     * The list is \"old\" and should no longer be considered accurate or relevant.
     */
    RETIRED,
    /**
     * The list was never accurate. It is retained for medico-legal purposes only.
     */
    ENTEREDINERROR,
    /**
     * added to help the parsers with the generic types
     */
    NULL;

    public static ListStatus fromCode(String codeString) throws FHIRException {
      if (codeString == null || "".equals(codeString))
        return null;
      if ("current".equals(codeString))
        return CURRENT;
      if ("retired".equals(codeString))
        return RETIRED;
      if ("entered-in-error".equals(codeString))
        return ENTEREDINERROR;
      if (Configuration.isAcceptInvalidEnums())
        return null;
      else
        throw new FHIRException("Unknown ListStatus code '" + codeString + "'");
    }

    public String toCode() {
      switch (this) {
      case CURRENT:
        return "current";
      case RETIRED:
        return "retired";
      case ENTEREDINERROR:
        return "entered-in-error";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getSystem() {
      switch (this) {
      case CURRENT:
        return "http://hl7.org/fhir/list-status";
      case RETIRED:
        return "http://hl7.org/fhir/list-status";
      case ENTEREDINERROR:
        return "http://hl7.org/fhir/list-status";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDefinition() {
      switch (this) {
      case CURRENT:
        return "The list is considered to be an active part of the patient's record.";
      case RETIRED:
        return "The list is \"old\" and should no longer be considered accurate or relevant.";
      case ENTEREDINERROR:
        return "The list was never accurate.  It is retained for medico-legal purposes only.";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDisplay() {
      switch (this) {
      case CURRENT:
        return "Current";
      case RETIRED:
        return "Retired";
      case ENTEREDINERROR:
        return "Entered In Error";
      case NULL:
        return null;
      default:
        return "?";
      }
    }
  }

  public static class ListStatusEnumFactory implements EnumFactory<ListStatus> {
    public ListStatus fromCode(String codeString) throws IllegalArgumentException {
      if (codeString == null || "".equals(codeString))
        if (codeString == null || "".equals(codeString))
          return null;
      if ("current".equals(codeString))
        return ListStatus.CURRENT;
      if ("retired".equals(codeString))
        return ListStatus.RETIRED;
      if ("entered-in-error".equals(codeString))
        return ListStatus.ENTEREDINERROR;
      throw new IllegalArgumentException("Unknown ListStatus code '" + codeString + "'");
    }

    public Enumeration<ListStatus> fromType(PrimitiveType<?> code) throws FHIRException {
      if (code == null)
        return null;
      if (code.isEmpty())
        return new Enumeration<ListStatus>(this, ListStatus.NULL, code);
      String codeString = code.asStringValue();
      if (codeString == null || "".equals(codeString))
        return new Enumeration<ListStatus>(this, ListStatus.NULL, code);
      if ("current".equals(codeString))
        return new Enumeration<ListStatus>(this, ListStatus.CURRENT, code);
      if ("retired".equals(codeString))
        return new Enumeration<ListStatus>(this, ListStatus.RETIRED, code);
      if ("entered-in-error".equals(codeString))
        return new Enumeration<ListStatus>(this, ListStatus.ENTEREDINERROR, code);
      throw new FHIRException("Unknown ListStatus code '" + codeString + "'");
    }

    public String toCode(ListStatus code) {
       if (code == ListStatus.NULL)
           return null;
       if (code == ListStatus.CURRENT)
        return "current";
      if (code == ListStatus.RETIRED)
        return "retired";
      if (code == ListStatus.ENTEREDINERROR)
        return "entered-in-error";
      return "?";
   }

    public String toSystem(ListStatus code) {
      return code.getSystem();
    }
  }

  @Block()
  public static class ListResourceEntryComponent extends BackboneElement implements IBaseBackboneElement {
    /**
     * The flag allows the system constructing the list to indicate the role and
     * significance of the item in the list.
     */
    @Child(name = "flag", type = {
        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
    @Description(shortDefinition = "Status/Workflow information about this item", formalDefinition = "The flag allows the system constructing the list to indicate the role and significance of the item in the list.")
    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/list-item-flag")
    protected CodeableConcept flag;

    /**
     * True if this item is marked as deleted in the list.
     */
    @Child(name = "deleted", type = {
        BooleanType.class }, order = 2, min = 0, max = 1, modifier = true, summary = false)
    @Description(shortDefinition = "If this item is actually marked as deleted", formalDefinition = "True if this item is marked as deleted in the list.")
    protected BooleanType deleted;

    /**
     * When this item was added to the list.
     */
    @Child(name = "date", type = { DateTimeType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
    @Description(shortDefinition = "When item added to list", formalDefinition = "When this item was added to the list.")
    protected DateTimeType date;

    /**
     * A reference to the actual resource from which data was derived.
     */
    @Child(name = "item", type = { Reference.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
    @Description(shortDefinition = "Actual entry", formalDefinition = "A reference to the actual resource from which data was derived.")
    protected Reference item;

    private static final long serialVersionUID = -872672029L;

    /**
     * Constructor
     */
    public ListResourceEntryComponent() {
      super();
    }

    /**
     * Constructor
     */
    public ListResourceEntryComponent(Reference item) {
      super();
      this.setItem(item);
    }

    /**
     * @return {@link #flag} (The flag allows the system constructing the list to
     *         indicate the role and significance of the item in the list.)
     */
    public CodeableConcept getFlag() {
      if (this.flag == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create ListResourceEntryComponent.flag");
        else if (Configuration.doAutoCreate())
          this.flag = new CodeableConcept(); // cc
      return this.flag;
    }

    public boolean hasFlag() {
      return this.flag != null && !this.flag.isEmpty();
    }

    /**
     * @param value {@link #flag} (The flag allows the system constructing the list
     *              to indicate the role and significance of the item in the list.)
     */
    public ListResourceEntryComponent setFlag(CodeableConcept value) {
      this.flag = value;
      return this;
    }

    /**
     * @return {@link #deleted} (True if this item is marked as deleted in the
     *         list.). This is the underlying object with id, value and extensions.
     *         The accessor "getDeleted" gives direct access to the value
     */
    public BooleanType getDeletedElement() {
      if (this.deleted == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create ListResourceEntryComponent.deleted");
        else if (Configuration.doAutoCreate())
          this.deleted = new BooleanType(); // bb
      return this.deleted;
    }

    public boolean hasDeletedElement() {
      return this.deleted != null && !this.deleted.isEmpty();
    }

    public boolean hasDeleted() {
      return this.deleted != null && !this.deleted.isEmpty();
    }

    /**
     * @param value {@link #deleted} (True if this item is marked as deleted in the
     *              list.). This is the underlying object with id, value and
     *              extensions. The accessor "getDeleted" gives direct access to the
     *              value
     */
    public ListResourceEntryComponent setDeletedElement(BooleanType value) {
      this.deleted = value;
      return this;
    }

    /**
     * @return True if this item is marked as deleted in the list.
     */
    public boolean getDeleted() {
      return this.deleted == null || this.deleted.isEmpty() ? false : this.deleted.getValue();
    }

    /**
     * @param value True if this item is marked as deleted in the list.
     */
    public ListResourceEntryComponent setDeleted(boolean value) {
      if (this.deleted == null)
        this.deleted = new BooleanType();
      this.deleted.setValue(value);
      return this;
    }

    /**
     * @return {@link #date} (When this item was added to the list.). This is the
     *         underlying object with id, value and extensions. The accessor
     *         "getDate" gives direct access to the value
     */
    public DateTimeType getDateElement() {
      if (this.date == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create ListResourceEntryComponent.date");
        else if (Configuration.doAutoCreate())
          this.date = new DateTimeType(); // bb
      return this.date;
    }

    public boolean hasDateElement() {
      return this.date != null && !this.date.isEmpty();
    }

    public boolean hasDate() {
      return this.date != null && !this.date.isEmpty();
    }

    /**
     * @param value {@link #date} (When this item was added to the list.). This is
     *              the underlying object with id, value and extensions. The
     *              accessor "getDate" gives direct access to the value
     */
    public ListResourceEntryComponent setDateElement(DateTimeType value) {
      this.date = value;
      return this;
    }

    /**
     * @return When this item was added to the list.
     */
    public Date getDate() {
      return this.date == null ? null : this.date.getValue();
    }

    /**
     * @param value When this item was added to the list.
     */
    public ListResourceEntryComponent setDate(Date value) {
      if (value == null)
        this.date = null;
      else {
        if (this.date == null)
          this.date = new DateTimeType();
        this.date.setValue(value);
      }
      return this;
    }

    /**
     * @return {@link #item} (A reference to the actual resource from which data was
     *         derived.)
     */
    public Reference getItem() {
      if (this.item == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create ListResourceEntryComponent.item");
        else if (Configuration.doAutoCreate())
          this.item = new Reference(); // cc
      return this.item;
    }

    public boolean hasItem() {
      return this.item != null && !this.item.isEmpty();
    }

    /**
     * @param value {@link #item} (A reference to the actual resource from which
     *              data was derived.)
     */
    public ListResourceEntryComponent setItem(Reference value) {
      this.item = value;
      return this;
    }

    protected void listChildren(List<Property> children) {
      super.listChildren(children);
      children.add(new Property("flag", "CodeableConcept",
          "The flag allows the system constructing the list to indicate the role and significance of the item in the list.",
          0, 1, flag));
      children.add(
          new Property("deleted", "boolean", "True if this item is marked as deleted in the list.", 0, 1, deleted));
      children.add(new Property("date", "dateTime", "When this item was added to the list.", 0, 1, date));
      children.add(new Property("item", "Reference(Any)",
          "A reference to the actual resource from which data was derived.", 0, 1, item));
    }

    @Override
    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
      switch (_hash) {
      case 3145580:
        /* flag */ return new Property("flag", "CodeableConcept",
            "The flag allows the system constructing the list to indicate the role and significance of the item in the list.",
            0, 1, flag);
      case 1550463001:
        /* deleted */ return new Property("deleted", "boolean", "True if this item is marked as deleted in the list.",
            0, 1, deleted);
      case 3076014:
        /* date */ return new Property("date", "dateTime", "When this item was added to the list.", 0, 1, date);
      case 3242771:
        /* item */ return new Property("item", "Reference(Any)",
            "A reference to the actual resource from which data was derived.", 0, 1, item);
      default:
        return super.getNamedProperty(_hash, _name, _checkValid);
      }

    }

    @Override
    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
      switch (hash) {
      case 3145580:
        /* flag */ return this.flag == null ? new Base[0] : new Base[] { this.flag }; // CodeableConcept
      case 1550463001:
        /* deleted */ return this.deleted == null ? new Base[0] : new Base[] { this.deleted }; // BooleanType
      case 3076014:
        /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateTimeType
      case 3242771:
        /* item */ return this.item == null ? new Base[0] : new Base[] { this.item }; // Reference
      default:
        return super.getProperty(hash, name, checkValid);
      }

    }

    @Override
    public Base setProperty(int hash, String name, Base value) throws FHIRException {
      switch (hash) {
      case 3145580: // flag
        this.flag = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
        return value;
      case 1550463001: // deleted
        this.deleted = TypeConvertor.castToBoolean(value); // BooleanType
        return value;
      case 3076014: // date
        this.date = TypeConvertor.castToDateTime(value); // DateTimeType
        return value;
      case 3242771: // item
        this.item = TypeConvertor.castToReference(value); // Reference
        return value;
      default:
        return super.setProperty(hash, name, value);
      }

    }

    @Override
    public Base setProperty(String name, Base value) throws FHIRException {
      if (name.equals("flag")) {
        this.flag = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
      } else if (name.equals("deleted")) {
        this.deleted = TypeConvertor.castToBoolean(value); // BooleanType
      } else if (name.equals("date")) {
        this.date = TypeConvertor.castToDateTime(value); // DateTimeType
      } else if (name.equals("item")) {
        this.item = TypeConvertor.castToReference(value); // Reference
      } else
        return super.setProperty(name, value);
      return value;
    }

  @Override
  public void removeChild(String name, Base value) throws FHIRException {
      if (name.equals("flag")) {
        this.flag = null;
      } else if (name.equals("deleted")) {
        this.deleted = null;
      } else if (name.equals("date")) {
        this.date = null;
      } else if (name.equals("item")) {
        this.item = null;
      } else
        super.removeChild(name, value);
      
    }

    @Override
    public Base makeProperty(int hash, String name) throws FHIRException {
      switch (hash) {
      case 3145580:
        return getFlag();
      case 1550463001:
        return getDeletedElement();
      case 3076014:
        return getDateElement();
      case 3242771:
        return getItem();
      default:
        return super.makeProperty(hash, name);
      }

    }

    @Override
    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
      switch (hash) {
      case 3145580:
        /* flag */ return new String[] { "CodeableConcept" };
      case 1550463001:
        /* deleted */ return new String[] { "boolean" };
      case 3076014:
        /* date */ return new String[] { "dateTime" };
      case 3242771:
        /* item */ return new String[] { "Reference" };
      default:
        return super.getTypesForProperty(hash, name);
      }

    }

    @Override
    public Base addChild(String name) throws FHIRException {
      if (name.equals("flag")) {
        this.flag = new CodeableConcept();
        return this.flag;
      } else if (name.equals("deleted")) {
        throw new FHIRException("Cannot call addChild on a singleton property List.entry.deleted");
      } else if (name.equals("date")) {
        throw new FHIRException("Cannot call addChild on a singleton property List.entry.date");
      } else if (name.equals("item")) {
        this.item = new Reference();
        return this.item;
      } else
        return super.addChild(name);
    }

    public ListResourceEntryComponent copy() {
      ListResourceEntryComponent dst = new ListResourceEntryComponent();
      copyValues(dst);
      return dst;
    }

    public void copyValues(ListResourceEntryComponent dst) {
      super.copyValues(dst);
      dst.flag = flag == null ? null : flag.copy();
      dst.deleted = deleted == null ? null : deleted.copy();
      dst.date = date == null ? null : date.copy();
      dst.item = item == null ? null : item.copy();
    }

    @Override
    public boolean equalsDeep(Base other_) {
      if (!super.equalsDeep(other_))
        return false;
      if (!(other_ instanceof ListResourceEntryComponent))
        return false;
      ListResourceEntryComponent o = (ListResourceEntryComponent) other_;
      return compareDeep(flag, o.flag, true) && compareDeep(deleted, o.deleted, true) && compareDeep(date, o.date, true)
          && compareDeep(item, o.item, true);
    }

    @Override
    public boolean equalsShallow(Base other_) {
      if (!super.equalsShallow(other_))
        return false;
      if (!(other_ instanceof ListResourceEntryComponent))
        return false;
      ListResourceEntryComponent o = (ListResourceEntryComponent) other_;
      return compareValues(deleted, o.deleted, true) && compareValues(date, o.date, true);
    }

    public boolean isEmpty() {
      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(flag, deleted, date, item);
    }

    public String fhirType() {
      return "List.entry";

    }

  }

  /**
   * Identifier for the List assigned for business purposes outside the context of
   * FHIR.
   */
  @Child(name = "identifier", type = {
      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
  @Description(shortDefinition = "Business identifier", formalDefinition = "Identifier for the List assigned for business purposes outside the context of FHIR.")
  protected List<Identifier> identifier;

  /**
   * Indicates the current state of this list.
   */
  @Child(name = "status", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = true, summary = true)
  @Description(shortDefinition = "current | retired | entered-in-error", formalDefinition = "Indicates the current state of this list.")
  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/list-status")
  protected Enumeration<ListStatus> status;

  /**
   * How this list was prepared - whether it is a working list that is suitable
   * for being maintained on an ongoing basis, or if it represents a snapshot of a
   * list of items from another source, or whether it is a prepared list where
   * items may be marked as added, modified or deleted.
   */
  @Child(name = "mode", type = { CodeType.class }, order = 2, min = 1, max = 1, modifier = true, summary = true)
  @Description(shortDefinition = "working | snapshot | changes", formalDefinition = "How this list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.")
  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/list-mode")
  protected Enumeration<ListMode> mode;

  /**
   * A label for the list assigned by the author.
   */
  @Child(name = "title", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
  @Description(shortDefinition = "Descriptive name for the list", formalDefinition = "A label for the list assigned by the author.")
  protected StringType title;

  /**
   * This code defines the purpose of the list - why it was created.
   */
  @Child(name = "code", type = { CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
  @Description(shortDefinition = "What the purpose of this list is", formalDefinition = "This code defines the purpose of the list - why it was created.")
  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/list-example-codes")
  protected CodeableConcept code;

  /**
   * The common subject (or patient) of the resources that are in the list if
   * there is one.
   */
  @Child(name = "subject", type = { Patient.class, Group.class, Device.class,
      Location.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
  @Description(shortDefinition = "If all resources have the same subject", formalDefinition = "The common subject (or patient) of the resources that are in the list if there is one.")
  protected Reference subject;

  /**
   * The encounter that is the context in which this list was created.
   */
  @Child(name = "encounter", type = { Encounter.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
  @Description(shortDefinition = "Context in which list created", formalDefinition = "The encounter that is the context in which this list was created.")
  protected Reference encounter;

  /**
   * The date that the list was prepared.
   */
  @Child(name = "date", type = { DateTimeType.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
  @Description(shortDefinition = "When the list was prepared", formalDefinition = "The date that the list was prepared.")
  protected DateTimeType date;

  /**
   * The entity responsible for deciding what the contents of the list were. Where
   * the list was created by a human, this is the same as the author of the list.
   */
  @Child(name = "source", type = { Practitioner.class, PractitionerRole.class, Patient.class,
      Device.class }, order = 8, min = 0, max = 1, modifier = false, summary = true)
  @Description(shortDefinition = "Who and/or what defined the list contents (aka Author)", formalDefinition = "The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list.")
  protected Reference source;

  /**
   * What order applies to the items in the list.
   */
  @Child(name = "orderedBy", type = {
      CodeableConcept.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
  @Description(shortDefinition = "What order the list has", formalDefinition = "What order applies to the items in the list.")
  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/list-order")
  protected CodeableConcept orderedBy;

  /**
   * Comments that apply to the overall list.
   */
  @Child(name = "note", type = {
      Annotation.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
  @Description(shortDefinition = "Comments about the list", formalDefinition = "Comments that apply to the overall list.")
  protected List<Annotation> note;

  /**
   * Entries in this list.
   */
  @Child(name = "entry", type = {}, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
  @Description(shortDefinition = "Entries in the list", formalDefinition = "Entries in this list.")
  protected List<ListResourceEntryComponent> entry;

  /**
   * If the list is empty, why the list is empty.
   */
  @Child(name = "emptyReason", type = {
      CodeableConcept.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
  @Description(shortDefinition = "Why list is empty", formalDefinition = "If the list is empty, why the list is empty.")
  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/list-empty-reason")
  protected CodeableConcept emptyReason;

  private static final long serialVersionUID = 1429954620L;

  /**
   * Constructor
   */
  public ListResource() {
    super();
  }

  /**
   * Constructor
   */
  public ListResource(ListStatus status, ListMode mode) {
    super();
    this.setStatus(status);
    this.setMode(mode);
  }

  /**
   * @return {@link #identifier} (Identifier for the List assigned for business
   *         purposes outside the context of FHIR.)
   */
  public List<Identifier> getIdentifier() {
    if (this.identifier == null)
      this.identifier = new ArrayList<Identifier>();
    return this.identifier;
  }

  /**
   * @return Returns a reference to <code>this</code> for easy method chaining
   */
  public ListResource setIdentifier(List<Identifier> theIdentifier) {
    this.identifier = theIdentifier;
    return this;
  }

  public boolean hasIdentifier() {
    if (this.identifier == null)
      return false;
    for (Identifier item : this.identifier)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public Identifier addIdentifier() { // 3
    Identifier t = new Identifier();
    if (this.identifier == null)
      this.identifier = new ArrayList<Identifier>();
    this.identifier.add(t);
    return t;
  }

  public ListResource addIdentifier(Identifier t) { // 3
    if (t == null)
      return this;
    if (this.identifier == null)
      this.identifier = new ArrayList<Identifier>();
    this.identifier.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #identifier}, creating
   *         it if it does not already exist {3}
   */
  public Identifier getIdentifierFirstRep() {
    if (getIdentifier().isEmpty()) {
      addIdentifier();
    }
    return getIdentifier().get(0);
  }

  /**
   * @return {@link #status} (Indicates the current state of this list.). This is
   *         the underlying object with id, value and extensions. The accessor
   *         "getStatus" gives direct access to the value
   */
  public Enumeration<ListStatus> getStatusElement() {
    if (this.status == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create ListResource.status");
      else if (Configuration.doAutoCreate())
        this.status = new Enumeration<ListStatus>(new ListStatusEnumFactory()); // bb
    return this.status;
  }

  public boolean hasStatusElement() {
    return this.status != null && !this.status.isEmpty();
  }

  public boolean hasStatus() {
    return this.status != null && !this.status.isEmpty();
  }

  /**
   * @param value {@link #status} (Indicates the current state of this list.).
   *              This is the underlying object with id, value and extensions. The
   *              accessor "getStatus" gives direct access to the value
   */
  public ListResource setStatusElement(Enumeration<ListStatus> value) {
    this.status = value;
    return this;
  }

  /**
   * @return Indicates the current state of this list.
   */
  public ListStatus getStatus() {
    return this.status == null ? null : this.status.getValue();
  }

  /**
   * @param value Indicates the current state of this list.
   */
  public ListResource setStatus(ListStatus value) {
    if (this.status == null)
      this.status = new Enumeration<ListStatus>(new ListStatusEnumFactory());
    this.status.setValue(value);
    return this;
  }

  /**
   * @return {@link #mode} (How this list was prepared - whether it is a working
   *         list that is suitable for being maintained on an ongoing basis, or if
   *         it represents a snapshot of a list of items from another source, or
   *         whether it is a prepared list where items may be marked as added,
   *         modified or deleted.). This is the underlying object with id, value
   *         and extensions. The accessor "getMode" gives direct access to the
   *         value
   */
  public Enumeration<ListMode> getModeElement() {
    if (this.mode == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create ListResource.mode");
      else if (Configuration.doAutoCreate())
        this.mode = new Enumeration<ListMode>(new ListModeEnumFactory()); // bb
    return this.mode;
  }

  public boolean hasModeElement() {
    return this.mode != null && !this.mode.isEmpty();
  }

  public boolean hasMode() {
    return this.mode != null && !this.mode.isEmpty();
  }

  /**
   * @param value {@link #mode} (How this list was prepared - whether it is a
   *              working list that is suitable for being maintained on an ongoing
   *              basis, or if it represents a snapshot of a list of items from
   *              another source, or whether it is a prepared list where items may
   *              be marked as added, modified or deleted.). This is the
   *              underlying object with id, value and extensions. The accessor
   *              "getMode" gives direct access to the value
   */
  public ListResource setModeElement(Enumeration<ListMode> value) {
    this.mode = value;
    return this;
  }

  /**
   * @return How this list was prepared - whether it is a working list that is
   *         suitable for being maintained on an ongoing basis, or if it
   *         represents a snapshot of a list of items from another source, or
   *         whether it is a prepared list where items may be marked as added,
   *         modified or deleted.
   */
  public ListMode getMode() {
    return this.mode == null ? null : this.mode.getValue();
  }

  /**
   * @param value How this list was prepared - whether it is a working list that
   *              is suitable for being maintained on an ongoing basis, or if it
   *              represents a snapshot of a list of items from another source, or
   *              whether it is a prepared list where items may be marked as
   *              added, modified or deleted.
   */
  public ListResource setMode(ListMode value) {
    if (this.mode == null)
      this.mode = new Enumeration<ListMode>(new ListModeEnumFactory());
    this.mode.setValue(value);
    return this;
  }

  /**
   * @return {@link #title} (A label for the list assigned by the author.). This
   *         is the underlying object with id, value and extensions. The accessor
   *         "getTitle" gives direct access to the value
   */
  public StringType getTitleElement() {
    if (this.title == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create ListResource.title");
      else if (Configuration.doAutoCreate())
        this.title = new StringType(); // bb
    return this.title;
  }

  public boolean hasTitleElement() {
    return this.title != null && !this.title.isEmpty();
  }

  public boolean hasTitle() {
    return this.title != null && !this.title.isEmpty();
  }

  /**
   * @param value {@link #title} (A label for the list assigned by the author.).
   *              This is the underlying object with id, value and extensions. The
   *              accessor "getTitle" gives direct access to the value
   */
  public ListResource setTitleElement(StringType value) {
    this.title = value;
    return this;
  }

  /**
   * @return A label for the list assigned by the author.
   */
  public String getTitle() {
    return this.title == null ? null : this.title.getValue();
  }

  /**
   * @param value A label for the list assigned by the author.
   */
  public ListResource setTitle(String value) {
    if (Utilities.noString(value))
      this.title = null;
    else {
      if (this.title == null)
        this.title = new StringType();
      this.title.setValue(value);
    }
    return this;
  }

  /**
   * @return {@link #code} (This code defines the purpose of the list - why it was
   *         created.)
   */
  public CodeableConcept getCode() {
    if (this.code == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create ListResource.code");
      else if (Configuration.doAutoCreate())
        this.code = new CodeableConcept(); // cc
    return this.code;
  }

  public boolean hasCode() {
    return this.code != null && !this.code.isEmpty();
  }

  /**
   * @param value {@link #code} (This code defines the purpose of the list - why
   *              it was created.)
   */
  public ListResource setCode(CodeableConcept value) {
    this.code = value;
    return this;
  }

  /**
   * @return {@link #subject} (The common subject (or patient) of the resources
   *         that are in the list if there is one.)
   */
  public Reference getSubject() {
    if (this.subject == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create ListResource.subject");
      else if (Configuration.doAutoCreate())
        this.subject = new Reference(); // cc
    return this.subject;
  }

  public boolean hasSubject() {
    return this.subject != null && !this.subject.isEmpty();
  }

  /**
   * @param value {@link #subject} (The common subject (or patient) of the
   *              resources that are in the list if there is one.)
   */
  public ListResource setSubject(Reference value) {
    this.subject = value;
    return this;
  }

  /**
   * @return {@link #encounter} (The encounter that is the context in which this
   *         list was created.)
   */
  public Reference getEncounter() {
    if (this.encounter == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create ListResource.encounter");
      else if (Configuration.doAutoCreate())
        this.encounter = new Reference(); // cc
    return this.encounter;
  }

  public boolean hasEncounter() {
    return this.encounter != null && !this.encounter.isEmpty();
  }

  /**
   * @param value {@link #encounter} (The encounter that is the context in which
   *              this list was created.)
   */
  public ListResource setEncounter(Reference value) {
    this.encounter = value;
    return this;
  }

  /**
   * @return {@link #date} (The date that the list was prepared.). This is the
   *         underlying object with id, value and extensions. The accessor
   *         "getDate" gives direct access to the value
   */
  public DateTimeType getDateElement() {
    if (this.date == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create ListResource.date");
      else if (Configuration.doAutoCreate())
        this.date = new DateTimeType(); // bb
    return this.date;
  }

  public boolean hasDateElement() {
    return this.date != null && !this.date.isEmpty();
  }

  public boolean hasDate() {
    return this.date != null && !this.date.isEmpty();
  }

  /**
   * @param value {@link #date} (The date that the list was prepared.). This is
   *              the underlying object with id, value and extensions. The
   *              accessor "getDate" gives direct access to the value
   */
  public ListResource setDateElement(DateTimeType value) {
    this.date = value;
    return this;
  }

  /**
   * @return The date that the list was prepared.
   */
  public Date getDate() {
    return this.date == null ? null : this.date.getValue();
  }

  /**
   * @param value The date that the list was prepared.
   */
  public ListResource setDate(Date value) {
    if (value == null)
      this.date = null;
    else {
      if (this.date == null)
        this.date = new DateTimeType();
      this.date.setValue(value);
    }
    return this;
  }

  /**
   * @return {@link #source} (The entity responsible for deciding what the
   *         contents of the list were. Where the list was created by a human,
   *         this is the same as the author of the list.)
   */
  public Reference getSource() {
    if (this.source == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create ListResource.source");
      else if (Configuration.doAutoCreate())
        this.source = new Reference(); // cc
    return this.source;
  }

  public boolean hasSource() {
    return this.source != null && !this.source.isEmpty();
  }

  /**
   * @param value {@link #source} (The entity responsible for deciding what the
   *              contents of the list were. Where the list was created by a
   *              human, this is the same as the author of the list.)
   */
  public ListResource setSource(Reference value) {
    this.source = value;
    return this;
  }

  /**
   * @return {@link #orderedBy} (What order applies to the items in the list.)
   */
  public CodeableConcept getOrderedBy() {
    if (this.orderedBy == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create ListResource.orderedBy");
      else if (Configuration.doAutoCreate())
        this.orderedBy = new CodeableConcept(); // cc
    return this.orderedBy;
  }

  public boolean hasOrderedBy() {
    return this.orderedBy != null && !this.orderedBy.isEmpty();
  }

  /**
   * @param value {@link #orderedBy} (What order applies to the items in the
   *              list.)
   */
  public ListResource setOrderedBy(CodeableConcept value) {
    this.orderedBy = value;
    return this;
  }

  /**
   * @return {@link #note} (Comments that apply to the overall list.)
   */
  public List<Annotation> getNote() {
    if (this.note == null)
      this.note = new ArrayList<Annotation>();
    return this.note;
  }

  /**
   * @return Returns a reference to <code>this</code> for easy method chaining
   */
  public ListResource setNote(List<Annotation> theNote) {
    this.note = theNote;
    return this;
  }

  public boolean hasNote() {
    if (this.note == null)
      return false;
    for (Annotation item : this.note)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public Annotation addNote() { // 3
    Annotation t = new Annotation();
    if (this.note == null)
      this.note = new ArrayList<Annotation>();
    this.note.add(t);
    return t;
  }

  public ListResource addNote(Annotation t) { // 3
    if (t == null)
      return this;
    if (this.note == null)
      this.note = new ArrayList<Annotation>();
    this.note.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #note}, creating it if
   *         it does not already exist {3}
   */
  public Annotation getNoteFirstRep() {
    if (getNote().isEmpty()) {
      addNote();
    }
    return getNote().get(0);
  }

  /**
   * @return {@link #entry} (Entries in this list.)
   */
  public List<ListResourceEntryComponent> getEntry() {
    if (this.entry == null)
      this.entry = new ArrayList<ListResourceEntryComponent>();
    return this.entry;
  }

  /**
   * @return Returns a reference to <code>this</code> for easy method chaining
   */
  public ListResource setEntry(List<ListResourceEntryComponent> theEntry) {
    this.entry = theEntry;
    return this;
  }

  public boolean hasEntry() {
    if (this.entry == null)
      return false;
    for (ListResourceEntryComponent item : this.entry)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public ListResourceEntryComponent addEntry() { // 3
    ListResourceEntryComponent t = new ListResourceEntryComponent();
    if (this.entry == null)
      this.entry = new ArrayList<ListResourceEntryComponent>();
    this.entry.add(t);
    return t;
  }

  public ListResource addEntry(ListResourceEntryComponent t) { // 3
    if (t == null)
      return this;
    if (this.entry == null)
      this.entry = new ArrayList<ListResourceEntryComponent>();
    this.entry.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #entry}, creating it
   *         if it does not already exist {3}
   */
  public ListResourceEntryComponent getEntryFirstRep() {
    if (getEntry().isEmpty()) {
      addEntry();
    }
    return getEntry().get(0);
  }

  /**
   * @return {@link #emptyReason} (If the list is empty, why the list is empty.)
   */
  public CodeableConcept getEmptyReason() {
    if (this.emptyReason == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create ListResource.emptyReason");
      else if (Configuration.doAutoCreate())
        this.emptyReason = new CodeableConcept(); // cc
    return this.emptyReason;
  }

  public boolean hasEmptyReason() {
    return this.emptyReason != null && !this.emptyReason.isEmpty();
  }

  /**
   * @param value {@link #emptyReason} (If the list is empty, why the list is
   *              empty.)
   */
  public ListResource setEmptyReason(CodeableConcept value) {
    this.emptyReason = value;
    return this;
  }

  protected void listChildren(List<Property> children) {
    super.listChildren(children);
    children.add(new Property("identifier", "Identifier",
        "Identifier for the List assigned for business purposes outside the context of FHIR.", 0,
        java.lang.Integer.MAX_VALUE, identifier));
    children.add(new Property("status", "code", "Indicates the current state of this list.", 0, 1, status));
    children.add(new Property("mode", "code",
        "How this list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.",
        0, 1, mode));
    children.add(new Property("title", "string", "A label for the list assigned by the author.", 0, 1, title));
    children.add(new Property("code", "CodeableConcept",
        "This code defines the purpose of the list - why it was created.", 0, 1, code));
    children.add(new Property("subject", "Reference(Patient|Group|Device|Location)",
        "The common subject (or patient) of the resources that are in the list if there is one.", 0, 1, subject));
    children.add(new Property("encounter", "Reference(Encounter)",
        "The encounter that is the context in which this list was created.", 0, 1, encounter));
    children.add(new Property("date", "dateTime", "The date that the list was prepared.", 0, 1, date));
    children.add(new Property("source", "Reference(Practitioner|PractitionerRole|Patient|Device)",
        "The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list.",
        0, 1, source));
    children.add(
        new Property("orderedBy", "CodeableConcept", "What order applies to the items in the list.", 0, 1, orderedBy));
    children.add(new Property("note", "Annotation", "Comments that apply to the overall list.", 0,
        java.lang.Integer.MAX_VALUE, note));
    children.add(new Property("entry", "", "Entries in this list.", 0, java.lang.Integer.MAX_VALUE, entry));
    children.add(new Property("emptyReason", "CodeableConcept", "If the list is empty, why the list is empty.", 0, 1,
        emptyReason));
  }

  @Override
  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
    switch (_hash) {
    case -1618432855:
      /* identifier */ return new Property("identifier", "Identifier",
          "Identifier for the List assigned for business purposes outside the context of FHIR.", 0,
          java.lang.Integer.MAX_VALUE, identifier);
    case -892481550:
      /* status */ return new Property("status", "code", "Indicates the current state of this list.", 0, 1, status);
    case 3357091:
      /* mode */ return new Property("mode", "code",
          "How this list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.",
          0, 1, mode);
    case 110371416:
      /* title */ return new Property("title", "string", "A label for the list assigned by the author.", 0, 1, title);
    case 3059181:
      /* code */ return new Property("code", "CodeableConcept",
          "This code defines the purpose of the list - why it was created.", 0, 1, code);
    case -1867885268:
      /* subject */ return new Property("subject", "Reference(Patient|Group|Device|Location)",
          "The common subject (or patient) of the resources that are in the list if there is one.", 0, 1, subject);
    case 1524132147:
      /* encounter */ return new Property("encounter", "Reference(Encounter)",
          "The encounter that is the context in which this list was created.", 0, 1, encounter);
    case 3076014:
      /* date */ return new Property("date", "dateTime", "The date that the list was prepared.", 0, 1, date);
    case -896505829:
      /* source */ return new Property("source", "Reference(Practitioner|PractitionerRole|Patient|Device)",
          "The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list.",
          0, 1, source);
    case -391079516:
      /* orderedBy */ return new Property("orderedBy", "CodeableConcept",
          "What order applies to the items in the list.", 0, 1, orderedBy);
    case 3387378:
      /* note */ return new Property("note", "Annotation", "Comments that apply to the overall list.", 0,
          java.lang.Integer.MAX_VALUE, note);
    case 96667762:
      /* entry */ return new Property("entry", "", "Entries in this list.", 0, java.lang.Integer.MAX_VALUE, entry);
    case 1140135409:
      /* emptyReason */ return new Property("emptyReason", "CodeableConcept",
          "If the list is empty, why the list is empty.", 0, 1, emptyReason);
    default:
      return super.getNamedProperty(_hash, _name, _checkValid);
    }

  }

  @Override
  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
    switch (hash) {
    case -1618432855:
      /* identifier */ return this.identifier == null ? new Base[0]
          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
    case -892481550:
      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<ListStatus>
    case 3357091:
      /* mode */ return this.mode == null ? new Base[0] : new Base[] { this.mode }; // Enumeration<ListMode>
    case 110371416:
      /* title */ return this.title == null ? new Base[0] : new Base[] { this.title }; // StringType
    case 3059181:
      /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
    case -1867885268:
      /* subject */ return this.subject == null ? new Base[0] : new Base[] { this.subject }; // Reference
    case 1524132147:
      /* encounter */ return this.encounter == null ? new Base[0] : new Base[] { this.encounter }; // Reference
    case 3076014:
      /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateTimeType
    case -896505829:
      /* source */ return this.source == null ? new Base[0] : new Base[] { this.source }; // Reference
    case -391079516:
      /* orderedBy */ return this.orderedBy == null ? new Base[0] : new Base[] { this.orderedBy }; // CodeableConcept
    case 3387378:
      /* note */ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
    case 96667762:
      /* entry */ return this.entry == null ? new Base[0] : this.entry.toArray(new Base[this.entry.size()]); // ListResourceEntryComponent
    case 1140135409:
      /* emptyReason */ return this.emptyReason == null ? new Base[0] : new Base[] { this.emptyReason }; // CodeableConcept
    default:
      return super.getProperty(hash, name, checkValid);
    }

  }

  @Override
  public Base setProperty(int hash, String name, Base value) throws FHIRException {
    switch (hash) {
    case -1618432855: // identifier
      this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
      return value;
    case -892481550: // status
      value = new ListStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
      this.status = (Enumeration) value; // Enumeration<ListStatus>
      return value;
    case 3357091: // mode
      value = new ListModeEnumFactory().fromType(TypeConvertor.castToCode(value));
      this.mode = (Enumeration) value; // Enumeration<ListMode>
      return value;
    case 110371416: // title
      this.title = TypeConvertor.castToString(value); // StringType
      return value;
    case 3059181: // code
      this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
      return value;
    case -1867885268: // subject
      this.subject = TypeConvertor.castToReference(value); // Reference
      return value;
    case 1524132147: // encounter
      this.encounter = TypeConvertor.castToReference(value); // Reference
      return value;
    case 3076014: // date
      this.date = TypeConvertor.castToDateTime(value); // DateTimeType
      return value;
    case -896505829: // source
      this.source = TypeConvertor.castToReference(value); // Reference
      return value;
    case -391079516: // orderedBy
      this.orderedBy = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
      return value;
    case 3387378: // note
      this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
      return value;
    case 96667762: // entry
      this.getEntry().add((ListResourceEntryComponent) value); // ListResourceEntryComponent
      return value;
    case 1140135409: // emptyReason
      this.emptyReason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
      return value;
    default:
      return super.setProperty(hash, name, value);
    }

  }

  @Override
  public Base setProperty(String name, Base value) throws FHIRException {
    if (name.equals("identifier")) {
      this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
    } else if (name.equals("status")) {
      value = new ListStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
      this.status = (Enumeration) value; // Enumeration<ListStatus>
    } else if (name.equals("mode")) {
      value = new ListModeEnumFactory().fromType(TypeConvertor.castToCode(value));
      this.mode = (Enumeration) value; // Enumeration<ListMode>
    } else if (name.equals("title")) {
      this.title = TypeConvertor.castToString(value); // StringType
    } else if (name.equals("code")) {
      this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
    } else if (name.equals("subject")) {
      this.subject = TypeConvertor.castToReference(value); // Reference
    } else if (name.equals("encounter")) {
      this.encounter = TypeConvertor.castToReference(value); // Reference
    } else if (name.equals("date")) {
      this.date = TypeConvertor.castToDateTime(value); // DateTimeType
    } else if (name.equals("source")) {
      this.source = TypeConvertor.castToReference(value); // Reference
    } else if (name.equals("orderedBy")) {
      this.orderedBy = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
    } else if (name.equals("note")) {
      this.getNote().add(TypeConvertor.castToAnnotation(value));
    } else if (name.equals("entry")) {
      this.getEntry().add((ListResourceEntryComponent) value);
    } else if (name.equals("emptyReason")) {
      this.emptyReason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
    } else
      return super.setProperty(name, value);
    return value;
  }

  @Override
  public void removeChild(String name, Base value) throws FHIRException {
    if (name.equals("identifier")) {
      this.getIdentifier().remove(value);
    } else if (name.equals("status")) {
      this.status = null;
    } else if (name.equals("mode")) {
      this.mode = null;
    } else if (name.equals("title")) {
      this.title = null;
    } else if (name.equals("code")) {
      this.code = null;
    } else if (name.equals("subject")) {
      this.subject = null;
    } else if (name.equals("encounter")) {
      this.encounter = null;
    } else if (name.equals("date")) {
      this.date = null;
    } else if (name.equals("source")) {
      this.source = null;
    } else if (name.equals("orderedBy")) {
      this.orderedBy = null;
    } else if (name.equals("note")) {
      this.getNote().remove(value);
    } else if (name.equals("entry")) {
      this.getEntry().remove((ListResourceEntryComponent) value);
    } else if (name.equals("emptyReason")) {
      this.emptyReason = null;
    } else
      super.removeChild(name, value);
    
  }

  @Override
  public Base makeProperty(int hash, String name) throws FHIRException {
    switch (hash) {
    case -1618432855:
      return addIdentifier();
    case -892481550:
      return getStatusElement();
    case 3357091:
      return getModeElement();
    case 110371416:
      return getTitleElement();
    case 3059181:
      return getCode();
    case -1867885268:
      return getSubject();
    case 1524132147:
      return getEncounter();
    case 3076014:
      return getDateElement();
    case -896505829:
      return getSource();
    case -391079516:
      return getOrderedBy();
    case 3387378:
      return addNote();
    case 96667762:
      return addEntry();
    case 1140135409:
      return getEmptyReason();
    default:
      return super.makeProperty(hash, name);
    }

  }

  @Override
  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
    switch (hash) {
    case -1618432855:
      /* identifier */ return new String[] { "Identifier" };
    case -892481550:
      /* status */ return new String[] { "code" };
    case 3357091:
      /* mode */ return new String[] { "code" };
    case 110371416:
      /* title */ return new String[] { "string" };
    case 3059181:
      /* code */ return new String[] { "CodeableConcept" };
    case -1867885268:
      /* subject */ return new String[] { "Reference" };
    case 1524132147:
      /* encounter */ return new String[] { "Reference" };
    case 3076014:
      /* date */ return new String[] { "dateTime" };
    case -896505829:
      /* source */ return new String[] { "Reference" };
    case -391079516:
      /* orderedBy */ return new String[] { "CodeableConcept" };
    case 3387378:
      /* note */ return new String[] { "Annotation" };
    case 96667762:
      /* entry */ return new String[] {};
    case 1140135409:
      /* emptyReason */ return new String[] { "CodeableConcept" };
    default:
      return super.getTypesForProperty(hash, name);
    }

  }

  @Override
  public Base addChild(String name) throws FHIRException {
    if (name.equals("identifier")) {
      return addIdentifier();
    } else if (name.equals("status")) {
      throw new FHIRException("Cannot call addChild on a singleton property List.status");
    } else if (name.equals("mode")) {
      throw new FHIRException("Cannot call addChild on a singleton property List.mode");
    } else if (name.equals("title")) {
      throw new FHIRException("Cannot call addChild on a singleton property List.title");
    } else if (name.equals("code")) {
      this.code = new CodeableConcept();
      return this.code;
    } else if (name.equals("subject")) {
      this.subject = new Reference();
      return this.subject;
    } else if (name.equals("encounter")) {
      this.encounter = new Reference();
      return this.encounter;
    } else if (name.equals("date")) {
      throw new FHIRException("Cannot call addChild on a singleton property List.date");
    } else if (name.equals("source")) {
      this.source = new Reference();
      return this.source;
    } else if (name.equals("orderedBy")) {
      this.orderedBy = new CodeableConcept();
      return this.orderedBy;
    } else if (name.equals("note")) {
      return addNote();
    } else if (name.equals("entry")) {
      return addEntry();
    } else if (name.equals("emptyReason")) {
      this.emptyReason = new CodeableConcept();
      return this.emptyReason;
    } else
      return super.addChild(name);
  }

  public String fhirType() {
    return "List";

  }

  public ListResource copy() {
    ListResource dst = new ListResource();
    copyValues(dst);
    return dst;
  }

  public void copyValues(ListResource dst) {
    super.copyValues(dst);
    if (identifier != null) {
      dst.identifier = new ArrayList<Identifier>();
      for (Identifier i : identifier)
        dst.identifier.add(i.copy());
    }
    ;
    dst.status = status == null ? null : status.copy();
    dst.mode = mode == null ? null : mode.copy();
    dst.title = title == null ? null : title.copy();
    dst.code = code == null ? null : code.copy();
    dst.subject = subject == null ? null : subject.copy();
    dst.encounter = encounter == null ? null : encounter.copy();
    dst.date = date == null ? null : date.copy();
    dst.source = source == null ? null : source.copy();
    dst.orderedBy = orderedBy == null ? null : orderedBy.copy();
    if (note != null) {
      dst.note = new ArrayList<Annotation>();
      for (Annotation i : note)
        dst.note.add(i.copy());
    }
    ;
    if (entry != null) {
      dst.entry = new ArrayList<ListResourceEntryComponent>();
      for (ListResourceEntryComponent i : entry)
        dst.entry.add(i.copy());
    }
    ;
    dst.emptyReason = emptyReason == null ? null : emptyReason.copy();
  }

  protected ListResource typedCopy() {
    return copy();
  }

  @Override
  public boolean equalsDeep(Base other_) {
    if (!super.equalsDeep(other_))
      return false;
    if (!(other_ instanceof ListResource))
      return false;
    ListResource o = (ListResource) other_;
    return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true)
        && compareDeep(mode, o.mode, true) && compareDeep(title, o.title, true) && compareDeep(code, o.code, true)
        && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true)
        && compareDeep(date, o.date, true) && compareDeep(source, o.source, true)
        && compareDeep(orderedBy, o.orderedBy, true) && compareDeep(note, o.note, true)
        && compareDeep(entry, o.entry, true) && compareDeep(emptyReason, o.emptyReason, true);
  }

  @Override
  public boolean equalsShallow(Base other_) {
    if (!super.equalsShallow(other_))
      return false;
    if (!(other_ instanceof ListResource))
      return false;
    ListResource o = (ListResource) other_;
    return compareValues(status, o.status, true) && compareValues(mode, o.mode, true)
        && compareValues(title, o.title, true) && compareValues(date, o.date, true);
  }

  public boolean isEmpty() {
    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, mode, title, code, subject,
        encounter, date, source, orderedBy, note, entry, emptyReason);
  }

  @Override
  public ResourceType getResourceType() {
    return ResourceType.List;
  }

  /**
   * Search parameter: <b>empty-reason</b>
   * <p>
   * Description: <b>Why list is empty</b><br>
   * Type: <b>token</b><br>
   * Path: <b>List.emptyReason</b><br>
   * </p>
   */
  @SearchParamDefinition(name = "empty-reason", path = "List.emptyReason", description = "Why list is empty", type = "token")
  public static final String SP_EMPTY_REASON = "empty-reason";
  /**
   * <b>Fluent Client</b> search parameter constant for <b>empty-reason</b>
   * <p>
   * Description: <b>Why list is empty</b><br>
   * Type: <b>token</b><br>
   * Path: <b>List.emptyReason</b><br>
   * </p>
   */
  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EMPTY_REASON = new ca.uhn.fhir.rest.gclient.TokenClientParam(
      SP_EMPTY_REASON);

  /**
   * Search parameter: <b>item</b>
   * <p>
   * Description: <b>Actual entry</b><br>
   * Type: <b>reference</b><br>
   * Path: <b>List.entry.item</b><br>
   * </p>
   */
  @SearchParamDefinition(name = "item", path = "List.entry.item", description = "Actual entry", type = "reference", target = {
      Account.class, ActivityDefinition.class, AdministrableProductDefinition.class, AdverseEvent.class,
      AllergyIntolerance.class, Appointment.class, AppointmentResponse.class, AuditEvent.class, Basic.class,
      Binary.class, BiologicallyDerivedProduct.class, BodyStructure.class, Bundle.class, CapabilityStatement.class,
      CarePlan.class, CareTeam.class, CatalogEntry.class, ChargeItem.class, ChargeItemDefinition.class, Citation.class,
      Claim.class, ClaimResponse.class, ClinicalImpression.class, ClinicalUseDefinition.class, CodeSystem.class,
      Communication.class, CommunicationRequest.class, CompartmentDefinition.class, Composition.class, ConceptMap.class,
      Condition.class, Consent.class, Contract.class, Coverage.class, CoverageEligibilityRequest.class,
      CoverageEligibilityResponse.class, DetectedIssue.class, Device.class, DeviceDefinition.class, DeviceMetric.class,
      DeviceRequest.class, DeviceUseStatement.class, DiagnosticReport.class, DocumentManifest.class,
      DocumentReference.class, Encounter.class, Endpoint.class, EnrollmentRequest.class, EnrollmentResponse.class,
      EpisodeOfCare.class, EventDefinition.class, Evidence.class, EvidenceReport.class, EvidenceVariable.class,
      ExampleScenario.class, ExplanationOfBenefit.class, FamilyMemberHistory.class, Flag.class, Goal.class,
      GraphDefinition.class, Group.class, GuidanceResponse.class, HealthcareService.class, ImagingStudy.class,
      Immunization.class, ImmunizationEvaluation.class, ImmunizationRecommendation.class, ImplementationGuide.class,
      Ingredient.class, InsurancePlan.class, Invoice.class, Library.class, Linkage.class, ListResource.class,
      Location.class, ManufacturedItemDefinition.class, Measure.class, MeasureReport.class, Media.class,
      Medication.class, MedicationAdministration.class, MedicationDispense.class, MedicationKnowledge.class,
      MedicationRequest.class, MedicationStatement.class, MedicinalProductDefinition.class, MessageDefinition.class,
      MessageHeader.class, MolecularSequence.class, NamingSystem.class, NutritionOrder.class, NutritionProduct.class,
      Observation.class, ObservationDefinition.class, OperationDefinition.class, OperationOutcome.class,
      Organization.class, OrganizationAffiliation.class, PackagedProductDefinition.class, Patient.class,
      PaymentNotice.class, PaymentReconciliation.class, Person.class, PlanDefinition.class, Practitioner.class,
      PractitionerRole.class, Procedure.class, Provenance.class, Questionnaire.class, QuestionnaireResponse.class,
      RegulatedAuthorization.class, RelatedPerson.class, RequestGroup.class, ResearchDefinition.class,
      ResearchElementDefinition.class, ResearchStudy.class, ResearchSubject.class, RiskAssessment.class, Schedule.class,
      SearchParameter.class, ServiceRequest.class, Slot.class, Specimen.class, SpecimenDefinition.class,
      StructureDefinition.class, StructureMap.class, Subscription.class, SubscriptionStatus.class,
      SubscriptionTopic.class, Substance.class, SubstanceDefinition.class, SupplyDelivery.class, SupplyRequest.class,
      Task.class, TerminologyCapabilities.class, TestReport.class, TestScript.class, ValueSet.class,
      VerificationResult.class, VisionPrescription.class })
  public static final String SP_ITEM = "item";
  /**
   * <b>Fluent Client</b> search parameter constant for <b>item</b>
   * <p>
   * Description: <b>Actual entry</b><br>
   * Type: <b>reference</b><br>
   * Path: <b>List.entry.item</b><br>
   * </p>
   */
  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
      SP_ITEM);

  /**
   * Constant for fluent queries to be used to add include statements. Specifies
   * the path value of "<b>List:item</b>".
   */
  public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM = new ca.uhn.fhir.model.api.Include("List:item")
      .toLocked();

  /**
   * Search parameter: <b>notes</b>
   * <p>
   * Description: <b>The annotation - text content (as markdown)</b><br>
   * Type: <b>string</b><br>
   * Path: <b>List.note.text</b><br>
   * </p>
   */
  @SearchParamDefinition(name = "notes", path = "List.note.text", description = "The annotation  - text content (as markdown)", type = "string")
  public static final String SP_NOTES = "notes";
  /**
   * <b>Fluent Client</b> search parameter constant for <b>notes</b>
   * <p>
   * Description: <b>The annotation - text content (as markdown)</b><br>
   * Type: <b>string</b><br>
   * Path: <b>List.note.text</b><br>
   * </p>
   */
  public static final ca.uhn.fhir.rest.gclient.StringClientParam NOTES = new ca.uhn.fhir.rest.gclient.StringClientParam(
      SP_NOTES);

  /**
   * Search parameter: <b>source</b>
   * <p>
   * Description: <b>Who and/or what defined the list contents (aka
   * Author)</b><br>
   * Type: <b>reference</b><br>
   * Path: <b>List.source</b><br>
   * </p>
   */
  @SearchParamDefinition(name = "source", path = "List.source", description = "Who and/or what defined the list contents (aka Author)", type = "reference", providesMembershipIn = {
      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Base FHIR compartment definition for Device"),
      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Base FHIR compartment definition for Patient"),
      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Base FHIR compartment definition for Practitioner") }, target = {
          Device.class, Patient.class, Practitioner.class, PractitionerRole.class })
  public static final String SP_SOURCE = "source";
  /**
   * <b>Fluent Client</b> search parameter constant for <b>source</b>
   * <p>
   * Description: <b>Who and/or what defined the list contents (aka
   * Author)</b><br>
   * Type: <b>reference</b><br>
   * Path: <b>List.source</b><br>
   * </p>
   */
  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SOURCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
      SP_SOURCE);

  /**
   * Constant for fluent queries to be used to add include statements. Specifies
   * the path value of "<b>List:source</b>".
   */
  public static final ca.uhn.fhir.model.api.Include INCLUDE_SOURCE = new ca.uhn.fhir.model.api.Include("List:source")
      .toLocked();

  /**
   * Search parameter: <b>status</b>
   * <p>
   * Description: <b>current | retired | entered-in-error</b><br>
   * Type: <b>token</b><br>
   * Path: <b>List.status</b><br>
   * </p>
   */
  @SearchParamDefinition(name = "status", path = "List.status", description = "current | retired | entered-in-error", type = "token")
  public static final String SP_STATUS = "status";
  /**
   * <b>Fluent Client</b> search parameter constant for <b>status</b>
   * <p>
   * Description: <b>current | retired | entered-in-error</b><br>
   * Type: <b>token</b><br>
   * Path: <b>List.status</b><br>
   * </p>
   */
  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
      SP_STATUS);

  /**
   * Search parameter: <b>subject</b>
   * <p>
   * Description: <b>If all resources have the same subject</b><br>
   * Type: <b>reference</b><br>
   * Path: <b>List.subject</b><br>
   * </p>
   */
  @SearchParamDefinition(name = "subject", path = "List.subject", description = "If all resources have the same subject", type = "reference", providesMembershipIn = {
      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Base FHIR compartment definition for Device"),
      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Base FHIR compartment definition for Patient") }, target = {
          Device.class, Group.class, Location.class, Patient.class })
  public static final String SP_SUBJECT = "subject";
  /**
   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
   * <p>
   * Description: <b>If all resources have the same subject</b><br>
   * Type: <b>reference</b><br>
   * Path: <b>List.subject</b><br>
   * </p>
   */
  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
      SP_SUBJECT);

  /**
   * Constant for fluent queries to be used to add include statements. Specifies
   * the path value of "<b>List:subject</b>".
   */
  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("List:subject")
      .toLocked();

  /**
   * Search parameter: <b>title</b>
   * <p>
   * Description: <b>Descriptive name for the list</b><br>
   * Type: <b>string</b><br>
   * Path: <b>List.title</b><br>
   * </p>
   */
  @SearchParamDefinition(name = "title", path = "List.title", description = "Descriptive name for the list", type = "string")
  public static final String SP_TITLE = "title";
  /**
   * <b>Fluent Client</b> search parameter constant for <b>title</b>
   * <p>
   * Description: <b>Descriptive name for the list</b><br>
   * Type: <b>string</b><br>
   * Path: <b>List.title</b><br>
   * </p>
   */
  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(
      SP_TITLE);

  /**
   * Search parameter: <b>code</b>
   * <p>
   * Description: <b>Multiple Resources:
   * 
   * [AllergyIntolerance](allergyintolerance.html): Code that identifies the
   * allergy or intolerance [Condition](condition.html): Code for the condition
   * [DeviceRequest](devicerequest.html): Code for what is being requested/ordered
   * [DiagnosticReport](diagnosticreport.html): The code for the report, as
   * opposed to codes for the atomic results, which are the names on the
   * observation resource referred to from the result
   * [FamilyMemberHistory](familymemberhistory.html): A search by a condition code
   * [List](list.html): What the purpose of this list is
   * [Medication](medication.html): Returns medications for a specific code
   * [MedicationAdministration](medicationadministration.html): Return
   * administrations of this medication code
   * [MedicationDispense](medicationdispense.html): Returns dispenses of this
   * medicine code [MedicationRequest](medicationrequest.html): Return
   * prescriptions of this medication code
   * [MedicationStatement](medicationstatement.html): Return statements of this
   * medication code [Observation](observation.html): The code of the observation
   * type [Procedure](procedure.html): A code to identify a procedure
   * [ServiceRequest](servicerequest.html): What is being requested/ordered
   * </b><br>
   * Type: <b>token</b><br>
   * Path: <b>AllergyIntolerance.code | AllergyIntolerance.reaction.substance |
   * Condition.code | (DeviceRequest.code as CodeableConcept) |
   * DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code |
   * Medication.code | (MedicationAdministration.medication as CodeableConcept) |
   * (MedicationDispense.medication as CodeableConcept) |
   * (MedicationRequest.medication as CodeableConcept) |
   * (MedicationStatement.medication as CodeableConcept) | Observation.code |
   * Procedure.code | ServiceRequest.code</b><br>
   * </p>
   */
  @SearchParamDefinition(name = "code", path = "AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | (DeviceRequest.code as CodeableConcept) | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | (MedicationAdministration.medication as CodeableConcept) | (MedicationDispense.medication as CodeableConcept) | (MedicationRequest.medication as CodeableConcept) | (MedicationStatement.medication as CodeableConcept) | Observation.code | Procedure.code | ServiceRequest.code", description = "Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance\r\n* [Condition](condition.html): Code for the condition\r\n* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered\r\n* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code\r\n* [List](list.html): What the purpose of this list is\r\n* [Medication](medication.html): Returns medications for a specific code\r\n* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code\r\n* [MedicationStatement](medicationstatement.html): Return statements of this medication code\r\n* [Observation](observation.html): The code of the observation type\r\n* [Procedure](procedure.html): A code to identify a  procedure\r\n* [ServiceRequest](servicerequest.html): What is being requested/ordered\r\n", type = "token")
  public static final String SP_CODE = "code";
  /**
   * <b>Fluent Client</b> search parameter constant for <b>code</b>
   * <p>
   * Description: <b>Multiple Resources:
   * 
   * [AllergyIntolerance](allergyintolerance.html): Code that identifies the
   * allergy or intolerance [Condition](condition.html): Code for the condition
   * [DeviceRequest](devicerequest.html): Code for what is being requested/ordered
   * [DiagnosticReport](diagnosticreport.html): The code for the report, as
   * opposed to codes for the atomic results, which are the names on the
   * observation resource referred to from the result
   * [FamilyMemberHistory](familymemberhistory.html): A search by a condition code
   * [List](list.html): What the purpose of this list is
   * [Medication](medication.html): Returns medications for a specific code
   * [MedicationAdministration](medicationadministration.html): Return
   * administrations of this medication code
   * [MedicationDispense](medicationdispense.html): Returns dispenses of this
   * medicine code [MedicationRequest](medicationrequest.html): Return
   * prescriptions of this medication code
   * [MedicationStatement](medicationstatement.html): Return statements of this
   * medication code [Observation](observation.html): The code of the observation
   * type [Procedure](procedure.html): A code to identify a procedure
   * [ServiceRequest](servicerequest.html): What is being requested/ordered
   * </b><br>
   * Type: <b>token</b><br>
   * Path: <b>AllergyIntolerance.code | AllergyIntolerance.reaction.substance |
   * Condition.code | (DeviceRequest.code as CodeableConcept) |
   * DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code |
   * Medication.code | (MedicationAdministration.medication as CodeableConcept) |
   * (MedicationDispense.medication as CodeableConcept) |
   * (MedicationRequest.medication as CodeableConcept) |
   * (MedicationStatement.medication as CodeableConcept) | Observation.code |
   * Procedure.code | ServiceRequest.code</b><br>
   * </p>
   */
  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
      SP_CODE);

  /**
   * Search parameter: <b>date</b>
   * <p>
   * Description: <b>Multiple Resources:
   * 
   * [AllergyIntolerance](allergyintolerance.html): Date first version of the
   * resource instance was recorded [CarePlan](careplan.html): Time period plan
   * covers [CareTeam](careteam.html): Time period team covers
   * [ClinicalImpression](clinicalimpression.html): When the assessment was
   * documented [Composition](composition.html): Composition editing time
   * [Consent](consent.html): When this Consent was created or indexed
   * [DiagnosticReport](diagnosticreport.html): The clinically relevant time of
   * the report [Encounter](encounter.html): A date within the period the
   * Encounter lasted [EpisodeOfCare](episodeofcare.html): The provided date
   * search value falls within the episode of care's period
   * [FamilyMemberHistory](familymemberhistory.html): When history was recorded or
   * last updated [Flag](flag.html): Time period when flag is active
   * [Immunization](immunization.html): Vaccination (non)-Administration Date
   * [List](list.html): When the list was prepared
   * [Observation](observation.html): Obtained date/time. If the obtained element
   * is a period, a date that falls in the period [Procedure](procedure.html):
   * When the procedure was performed [RiskAssessment](riskassessment.html): When
   * was assessment made? [SupplyRequest](supplyrequest.html): When the request
   * was made </b><br>
   * Type: <b>date</b><br>
   * Path: <b>AllergyIntolerance.recordedDate | CarePlan.period | CareTeam.period
   * | ClinicalImpression.date | Composition.date | Consent.dateTime |
   * DiagnosticReport.effective | Encounter.period | EpisodeOfCare.period |
   * FamilyMemberHistory.date | Flag.period | Immunization.occurrence | List.date
   * | Observation.effective | Procedure.performed | (RiskAssessment.occurrence as
   * dateTime) | SupplyRequest.authoredOn</b><br>
   * </p>
   */
  @SearchParamDefinition(name = "date", path = "AllergyIntolerance.recordedDate | CarePlan.period | CareTeam.period | ClinicalImpression.date | Composition.date | Consent.dateTime | DiagnosticReport.effective | Encounter.period | EpisodeOfCare.period | FamilyMemberHistory.date | Flag.period | Immunization.occurrence | List.date | Observation.effective | Procedure.performed | (RiskAssessment.occurrence as dateTime) | SupplyRequest.authoredOn", description = "Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): Date first version of the resource instance was recorded\r\n* [CarePlan](careplan.html): Time period plan covers\r\n* [CareTeam](careteam.html): Time period team covers\r\n* [ClinicalImpression](clinicalimpression.html): When the assessment was documented\r\n* [Composition](composition.html): Composition editing time\r\n* [Consent](consent.html): When this Consent was created or indexed\r\n* [DiagnosticReport](diagnosticreport.html): The clinically relevant time of the report\r\n* [Encounter](encounter.html): A date within the period the Encounter lasted\r\n* [EpisodeOfCare](episodeofcare.html): The provided date search value falls within the episode of care's period\r\n* [FamilyMemberHistory](familymemberhistory.html): When history was recorded or last updated\r\n* [Flag](flag.html): Time period when flag is active\r\n* [Immunization](immunization.html): Vaccination  (non)-Administration Date\r\n* [List](list.html): When the list was prepared\r\n* [Observation](observation.html): Obtained date/time. If the obtained element is a period, a date that falls in the period\r\n* [Procedure](procedure.html): When the procedure was performed\r\n* [RiskAssessment](riskassessment.html): When was assessment made?\r\n* [SupplyRequest](supplyrequest.html): When the request was made\r\n", type = "date")
  public static final String SP_DATE = "date";
  /**
   * <b>Fluent Client</b> search parameter constant for <b>date</b>
   * <p>
   * Description: <b>Multiple Resources:
   * 
   * [AllergyIntolerance](allergyintolerance.html): Date first version of the
   * resource instance was recorded [CarePlan](careplan.html): Time period plan
   * covers [CareTeam](careteam.html): Time period team covers
   * [ClinicalImpression](clinicalimpression.html): When the assessment was
   * documented [Composition](composition.html): Composition editing time
   * [Consent](consent.html): When this Consent was created or indexed
   * [DiagnosticReport](diagnosticreport.html): The clinically relevant time of
   * the report [Encounter](encounter.html): A date within the period the
   * Encounter lasted [EpisodeOfCare](episodeofcare.html): The provided date
   * search value falls within the episode of care's period
   * [FamilyMemberHistory](familymemberhistory.html): When history was recorded or
   * last updated [Flag](flag.html): Time period when flag is active
   * [Immunization](immunization.html): Vaccination (non)-Administration Date
   * [List](list.html): When the list was prepared
   * [Observation](observation.html): Obtained date/time. If the obtained element
   * is a period, a date that falls in the period [Procedure](procedure.html):
   * When the procedure was performed [RiskAssessment](riskassessment.html): When
   * was assessment made? [SupplyRequest](supplyrequest.html): When the request
   * was made </b><br>
   * Type: <b>date</b><br>
   * Path: <b>AllergyIntolerance.recordedDate | CarePlan.period | CareTeam.period
   * | ClinicalImpression.date | Composition.date | Consent.dateTime |
   * DiagnosticReport.effective | Encounter.period | EpisodeOfCare.period |
   * FamilyMemberHistory.date | Flag.period | Immunization.occurrence | List.date
   * | Observation.effective | Procedure.performed | (RiskAssessment.occurrence as
   * dateTime) | SupplyRequest.authoredOn</b><br>
   * </p>
   */
  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
      SP_DATE);

  /**
   * Search parameter: <b>encounter</b>
   * <p>
   * Description: <b>Multiple Resources:
   * 
   * [Composition](composition.html): Context of the Composition
   * [DeviceRequest](devicerequest.html): Encounter during which request was
   * created [DiagnosticReport](diagnosticreport.html): The Encounter when the
   * order was made [DocumentReference](documentreference.html): Context of the
   * document content [Flag](flag.html): Alert relevant during encounter
   * [List](list.html): Context in which list created
   * [NutritionOrder](nutritionorder.html): Return nutrition orders with this
   * encounter identifier [Observation](observation.html): Encounter related to
   * the observation [Procedure](procedure.html): Encounter created as part of
   * [RiskAssessment](riskassessment.html): Where was assessment performed?
   * [ServiceRequest](servicerequest.html): An encounter in which this request is
   * made [VisionPrescription](visionprescription.html): Return prescriptions with
   * this encounter identifier </b><br>
   * Type: <b>reference</b><br>
   * Path: <b>Composition.encounter | DeviceRequest.encounter |
   * DiagnosticReport.encounter | DocumentReference.context.encounter |
   * Flag.encounter | List.encounter | NutritionOrder.encounter |
   * Observation.encounter | Procedure.encounter | RiskAssessment.encounter |
   * ServiceRequest.encounter | VisionPrescription.encounter</b><br>
   * </p>
   */
  @SearchParamDefinition(name = "encounter", path = "Composition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | DocumentReference.context.encounter | Flag.encounter | List.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | RiskAssessment.encounter | ServiceRequest.encounter | VisionPrescription.encounter", description = "Multiple Resources: \r\n\r\n* [Composition](composition.html): Context of the Composition\r\n* [DeviceRequest](devicerequest.html): Encounter during which request was created\r\n* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made\r\n* [DocumentReference](documentreference.html): Context of the document  content\r\n* [Flag](flag.html): Alert relevant during encounter\r\n* [List](list.html): Context in which list created\r\n* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier\r\n* [Observation](observation.html): Encounter related to the observation\r\n* [Procedure](procedure.html): Encounter created as part of\r\n* [RiskAssessment](riskassessment.html): Where was assessment performed?\r\n* [ServiceRequest](servicerequest.html): An encounter in which this request is made\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier\r\n", type = "reference", target = {
      Encounter.class, EpisodeOfCare.class })
  public static final String SP_ENCOUNTER = "encounter";
  /**
   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
   * <p>
   * Description: <b>Multiple Resources:
   * 
   * [Composition](composition.html): Context of the Composition
   * [DeviceRequest](devicerequest.html): Encounter during which request was
   * created [DiagnosticReport](diagnosticreport.html): The Encounter when the
   * order was made [DocumentReference](documentreference.html): Context of the
   * document content [Flag](flag.html): Alert relevant during encounter
   * [List](list.html): Context in which list created
   * [NutritionOrder](nutritionorder.html): Return nutrition orders with this
   * encounter identifier [Observation](observation.html): Encounter related to
   * the observation [Procedure](procedure.html): Encounter created as part of
   * [RiskAssessment](riskassessment.html): Where was assessment performed?
   * [ServiceRequest](servicerequest.html): An encounter in which this request is
   * made [VisionPrescription](visionprescription.html): Return prescriptions with
   * this encounter identifier </b><br>
   * Type: <b>reference</b><br>
   * Path: <b>Composition.encounter | DeviceRequest.encounter |
   * DiagnosticReport.encounter | DocumentReference.context.encounter |
   * Flag.encounter | List.encounter | NutritionOrder.encounter |
   * Observation.encounter | Procedure.encounter | RiskAssessment.encounter |
   * ServiceRequest.encounter | VisionPrescription.encounter</b><br>
   * </p>
   */
  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
      SP_ENCOUNTER);

  /**
   * Constant for fluent queries to be used to add include statements. Specifies
   * the path value of "<b>List:encounter</b>".
   */
  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include(
      "List:encounter").toLocked();

  /**
   * Search parameter: <b>identifier</b>
   * <p>
   * Description: <b>Multiple Resources:
   * 
   * [AllergyIntolerance](allergyintolerance.html): External ids for this item
   * [CarePlan](careplan.html): External Ids for this plan
   * [CareTeam](careteam.html): External Ids for this team
   * [Composition](composition.html): Version-independent identifier for the
   * Composition [Condition](condition.html): A unique identifier of the condition
   * record [Consent](consent.html): Identifier for this record (external
   * references) [DetectedIssue](detectedissue.html): Unique id for the detected
   * issue [DeviceRequest](devicerequest.html): Business identifier for
   * request/order [DiagnosticReport](diagnosticreport.html): An identifier for
   * the report [DocumentManifest](documentmanifest.html): Unique Identifier for
   * the set of documents [DocumentReference](documentreference.html): Master
   * Version Specific Identifier [Encounter](encounter.html): Identifier(s) by
   * which this encounter is known [EpisodeOfCare](episodeofcare.html): Business
   * Identifier(s) relevant for this EpisodeOfCare
   * [FamilyMemberHistory](familymemberhistory.html): A search by a record
   * identifier [Goal](goal.html): External Ids for this goal
   * [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM
   * Study Instance UID and Accession number [Immunization](immunization.html):
   * Business identifier [List](list.html): Business identifier
   * [MedicationAdministration](medicationadministration.html): Return
   * administrations with this external identifier
   * [MedicationDispense](medicationdispense.html): Returns dispenses with this
   * external identifier [MedicationRequest](medicationrequest.html): Return
   * prescriptions with this external identifier
   * [MedicationStatement](medicationstatement.html): Return statements with this
   * external identifier [NutritionOrder](nutritionorder.html): Return nutrition
   * orders with this external identifier [Observation](observation.html): The
   * unique id for a particular observation [Procedure](procedure.html): A unique
   * identifier for a procedure [RiskAssessment](riskassessment.html): Unique
   * identifier for the assessment [ServiceRequest](servicerequest.html):
   * Identifiers assigned to this order [SupplyDelivery](supplydelivery.html):
   * External identifier [SupplyRequest](supplyrequest.html): Business Identifier
   * for SupplyRequest [VisionPrescription](visionprescription.html): Return
   * prescriptions with this external identifier </b><br>
   * Type: <b>token</b><br>
   * Path: <b>AllergyIntolerance.identifier | CarePlan.identifier |
   * CareTeam.identifier | Composition.identifier | Condition.identifier |
   * Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier |
   * DiagnosticReport.identifier | DocumentManifest.masterIdentifier |
   * DocumentManifest.identifier | DocumentReference.masterIdentifier |
   * DocumentReference.identifier | Encounter.identifier |
   * EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier |
   * ImagingStudy.identifier | Immunization.identifier | List.identifier |
   * MedicationAdministration.identifier | MedicationDispense.identifier |
   * MedicationRequest.identifier | MedicationStatement.identifier |
   * NutritionOrder.identifier | Observation.identifier | Procedure.identifier |
   * RiskAssessment.identifier | ServiceRequest.identifier |
   * SupplyDelivery.identifier | SupplyRequest.identifier |
   * VisionPrescription.identifier</b><br>
   * </p>
   */
  @SearchParamDefinition(name = "identifier", path = "AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.masterIdentifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationStatement.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier", description = "Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): External ids for this item\r\n* [CarePlan](careplan.html): External Ids for this plan\r\n* [CareTeam](careteam.html): External Ids for this team\r\n* [Composition](composition.html): Version-independent identifier for the Composition\r\n* [Condition](condition.html): A unique identifier of the condition record\r\n* [Consent](consent.html): Identifier for this record (external references)\r\n* [DetectedIssue](detectedissue.html): Unique id for the detected issue\r\n* [DeviceRequest](devicerequest.html): Business identifier for request/order\r\n* [DiagnosticReport](diagnosticreport.html): An identifier for the report\r\n* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents\r\n* [DocumentReference](documentreference.html): Master Version Specific Identifier\r\n* [Encounter](encounter.html): Identifier(s) by which this encounter is known\r\n* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier\r\n* [Goal](goal.html): External Ids for this goal\r\n* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID and Accession number\r\n* [Immunization](immunization.html): Business identifier\r\n* [List](list.html): Business identifier\r\n* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier\r\n* [MedicationStatement](medicationstatement.html): Return statements with this external identifier\r\n* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier\r\n* [Observation](observation.html): The unique id for a particular observation\r\n* [Procedure](procedure.html): A unique identifier for a procedure\r\n* [RiskAssessment](riskassessment.html): Unique identifier for the assessment\r\n* [ServiceRequest](servicerequest.html): Identifiers assigned to this order\r\n* [SupplyDelivery](supplydelivery.html): External identifier\r\n* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier\r\n", type = "token")
  public static final String SP_IDENTIFIER = "identifier";
  /**
   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
   * <p>
   * Description: <b>Multiple Resources:
   * 
   * [AllergyIntolerance](allergyintolerance.html): External ids for this item
   * [CarePlan](careplan.html): External Ids for this plan
   * [CareTeam](careteam.html): External Ids for this team
   * [Composition](composition.html): Version-independent identifier for the
   * Composition [Condition](condition.html): A unique identifier of the condition
   * record [Consent](consent.html): Identifier for this record (external
   * references) [DetectedIssue](detectedissue.html): Unique id for the detected
   * issue [DeviceRequest](devicerequest.html): Business identifier for
   * request/order [DiagnosticReport](diagnosticreport.html): An identifier for
   * the report [DocumentManifest](documentmanifest.html): Unique Identifier for
   * the set of documents [DocumentReference](documentreference.html): Master
   * Version Specific Identifier [Encounter](encounter.html): Identifier(s) by
   * which this encounter is known [EpisodeOfCare](episodeofcare.html): Business
   * Identifier(s) relevant for this EpisodeOfCare
   * [FamilyMemberHistory](familymemberhistory.html): A search by a record
   * identifier [Goal](goal.html): External Ids for this goal
   * [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM
   * Study Instance UID and Accession number [Immunization](immunization.html):
   * Business identifier [List](list.html): Business identifier
   * [MedicationAdministration](medicationadministration.html): Return
   * administrations with this external identifier
   * [MedicationDispense](medicationdispense.html): Returns dispenses with this
   * external identifier [MedicationRequest](medicationrequest.html): Return
   * prescriptions with this external identifier
   * [MedicationStatement](medicationstatement.html): Return statements with this
   * external identifier [NutritionOrder](nutritionorder.html): Return nutrition
   * orders with this external identifier [Observation](observation.html): The
   * unique id for a particular observation [Procedure](procedure.html): A unique
   * identifier for a procedure [RiskAssessment](riskassessment.html): Unique
   * identifier for the assessment [ServiceRequest](servicerequest.html):
   * Identifiers assigned to this order [SupplyDelivery](supplydelivery.html):
   * External identifier [SupplyRequest](supplyrequest.html): Business Identifier
   * for SupplyRequest [VisionPrescription](visionprescription.html): Return
   * prescriptions with this external identifier </b><br>
   * Type: <b>token</b><br>
   * Path: <b>AllergyIntolerance.identifier | CarePlan.identifier |
   * CareTeam.identifier | Composition.identifier | Condition.identifier |
   * Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier |
   * DiagnosticReport.identifier | DocumentManifest.masterIdentifier |
   * DocumentManifest.identifier | DocumentReference.masterIdentifier |
   * DocumentReference.identifier | Encounter.identifier |
   * EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier |
   * ImagingStudy.identifier | Immunization.identifier | List.identifier |
   * MedicationAdministration.identifier | MedicationDispense.identifier |
   * MedicationRequest.identifier | MedicationStatement.identifier |
   * NutritionOrder.identifier | Observation.identifier | Procedure.identifier |
   * RiskAssessment.identifier | ServiceRequest.identifier |
   * SupplyDelivery.identifier | SupplyRequest.identifier |
   * VisionPrescription.identifier</b><br>
   * </p>
   */
  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
      SP_IDENTIFIER);

  /**
   * Search parameter: <b>patient</b>
   * <p>
   * Description: <b>Multiple Resources:
   * 
   * [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
   * [CarePlan](careplan.html): Who the care plan is for
   * [CareTeam](careteam.html): Who care team is for
   * [ClinicalImpression](clinicalimpression.html): Patient or group assessed
   * [Composition](composition.html): Who and/or what the composition is about
   * [Condition](condition.html): Who has the condition? [Consent](consent.html):
   * Who the consent applies to [DetectedIssue](detectedissue.html): Associated
   * patient [DeviceRequest](devicerequest.html): Individual the service is
   * ordered for [DeviceUseStatement](deviceusestatement.html): Search by subject
   * - a patient [DiagnosticReport](diagnosticreport.html): The subject of the
   * report if a patient [DocumentManifest](documentmanifest.html): The subject of
   * the set of documents [DocumentReference](documentreference.html): Who/what is
   * the subject of the document [Encounter](encounter.html): The patient or group
   * present at the encounter [EpisodeOfCare](episodeofcare.html): The patient who
   * is the focus of this episode of care
   * [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to
   * list family member history items for [Flag](flag.html): The identity of a
   * subject to list flags for [Goal](goal.html): Who this goal is intended for
   * [ImagingStudy](imagingstudy.html): Who the study is about
   * [Immunization](immunization.html): The patient for the vaccination record
   * [List](list.html): If all resources have the same subject
   * [MedicationAdministration](medicationadministration.html): The identity of a
   * patient to list administrations for
   * [MedicationDispense](medicationdispense.html): The identity of a patient to
   * list dispenses for [MedicationRequest](medicationrequest.html): Returns
   * prescriptions for a specific patient
   * [MedicationStatement](medicationstatement.html): Returns statements for a
   * specific patient. [NutritionOrder](nutritionorder.html): The identity of the
   * person who requires the diet, formula or nutritional supplement
   * [Observation](observation.html): The subject that the observation is about
   * (if patient) [Procedure](procedure.html): Search by subject - a patient
   * [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
   * [ServiceRequest](servicerequest.html): Search by subject - a patient
   * [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
   * [VisionPrescription](visionprescription.html): The identity of a patient to
   * list dispenses for </b><br>
   * Type: <b>reference</b><br>
   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is
   * Patient) | CareTeam.subject.where(resolve() is Patient) |
   * ClinicalImpression.subject.where(resolve() is Patient) |
   * Composition.subject.where(resolve() is Patient) |
   * Condition.subject.where(resolve() is Patient) | Consent.patient |
   * DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) |
   * DeviceUseStatement.subject.where(resolve() is Patient) |
   * DiagnosticReport.subject.where(resolve() is Patient) |
   * DocumentManifest.subject.where(resolve() is Patient) |
   * DocumentReference.subject.where(resolve() is Patient) |
   * Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient |
   * FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) |
   * Goal.subject.where(resolve() is Patient) |
   * ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient |
   * List.subject.where(resolve() is Patient) |
   * MedicationAdministration.subject.where(resolve() is Patient) |
   * MedicationDispense.subject.where(resolve() is Patient) |
   * MedicationRequest.subject.where(resolve() is Patient) |
   * MedicationStatement.subject.where(resolve() is Patient) |
   * NutritionOrder.patient | Observation.subject.where(resolve() is Patient) |
   * Procedure.subject.where(resolve() is Patient) |
   * RiskAssessment.subject.where(resolve() is Patient) |
   * ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient |
   * VisionPrescription.patient</b><br>
   * </p>
   */
  @SearchParamDefinition(name = "patient", path = "AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.patient | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUseStatement.subject.where(resolve() is Patient) | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationStatement.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient", description = "Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for\r\n* [CarePlan](careplan.html): Who the care plan is for\r\n* [CareTeam](careteam.html): Who care team is for\r\n* [ClinicalImpression](clinicalimpression.html): Patient or group assessed\r\n* [Composition](composition.html): Who and/or what the composition is about\r\n* [Condition](condition.html): Who has the condition?\r\n* [Consent](consent.html): Who the consent applies to\r\n* [DetectedIssue](detectedissue.html): Associated patient\r\n* [DeviceRequest](devicerequest.html): Individual the service is ordered for\r\n* [DeviceUseStatement](deviceusestatement.html): Search by subject - a patient\r\n* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient\r\n* [DocumentManifest](documentmanifest.html): The subject of the set of documents\r\n* [DocumentReference](documentreference.html): Who/what is the subject of the document\r\n* [Encounter](encounter.html): The patient or group present at the encounter\r\n* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care\r\n* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for\r\n* [Flag](flag.html): The identity of a subject to list flags for\r\n* [Goal](goal.html): Who this goal is intended for\r\n* [ImagingStudy](imagingstudy.html): Who the study is about\r\n* [Immunization](immunization.html): The patient for the vaccination record\r\n* [List](list.html): If all resources have the same subject\r\n* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for\r\n* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for\r\n* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient\r\n* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.\r\n* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement\r\n* [Observation](observation.html): The subject that the observation is about (if patient)\r\n* [Procedure](procedure.html): Search by subject - a patient\r\n* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?\r\n* [ServiceRequest](servicerequest.html): Search by subject - a patient\r\n* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied\r\n* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for\r\n", type = "reference", target = {
      Account.class, ActivityDefinition.class, AdministrableProductDefinition.class, AdverseEvent.class,
      AllergyIntolerance.class, Appointment.class, AppointmentResponse.class, AuditEvent.class, Basic.class,
      Binary.class, BiologicallyDerivedProduct.class, BodyStructure.class, Bundle.class, CapabilityStatement.class,
      CarePlan.class, CareTeam.class, CatalogEntry.class, ChargeItem.class, ChargeItemDefinition.class, Citation.class,
      Claim.class, ClaimResponse.class, ClinicalImpression.class, ClinicalUseDefinition.class, CodeSystem.class,
      Communication.class, CommunicationRequest.class, CompartmentDefinition.class, Composition.class, ConceptMap.class,
      Condition.class, Consent.class, Contract.class, Coverage.class, CoverageEligibilityRequest.class,
      CoverageEligibilityResponse.class, DetectedIssue.class, Device.class, DeviceDefinition.class, DeviceMetric.class,
      DeviceRequest.class, DeviceUseStatement.class, DiagnosticReport.class, DocumentManifest.class,
      DocumentReference.class, Encounter.class, Endpoint.class, EnrollmentRequest.class, EnrollmentResponse.class,
      EpisodeOfCare.class, EventDefinition.class, Evidence.class, EvidenceReport.class, EvidenceVariable.class,
      ExampleScenario.class, ExplanationOfBenefit.class, FamilyMemberHistory.class, Flag.class, Goal.class,
      GraphDefinition.class, Group.class, GuidanceResponse.class, HealthcareService.class, ImagingStudy.class,
      Immunization.class, ImmunizationEvaluation.class, ImmunizationRecommendation.class, ImplementationGuide.class,
      Ingredient.class, InsurancePlan.class, Invoice.class, Library.class, Linkage.class, ListResource.class,
      Location.class, ManufacturedItemDefinition.class, Measure.class, MeasureReport.class, Media.class,
      Medication.class, MedicationAdministration.class, MedicationDispense.class, MedicationKnowledge.class,
      MedicationRequest.class, MedicationStatement.class, MedicinalProductDefinition.class, MessageDefinition.class,
      MessageHeader.class, MolecularSequence.class, NamingSystem.class, NutritionOrder.class, NutritionProduct.class,
      Observation.class, ObservationDefinition.class, OperationDefinition.class, OperationOutcome.class,
      Organization.class, OrganizationAffiliation.class, PackagedProductDefinition.class, Patient.class,
      PaymentNotice.class, PaymentReconciliation.class, Person.class, PlanDefinition.class, Practitioner.class,
      PractitionerRole.class, Procedure.class, Provenance.class, Questionnaire.class, QuestionnaireResponse.class,
      RegulatedAuthorization.class, RelatedPerson.class, RequestGroup.class, ResearchDefinition.class,
      ResearchElementDefinition.class, ResearchStudy.class, ResearchSubject.class, RiskAssessment.class, Schedule.class,
      SearchParameter.class, ServiceRequest.class, Slot.class, Specimen.class, SpecimenDefinition.class,
      StructureDefinition.class, StructureMap.class, Subscription.class, SubscriptionStatus.class,
      SubscriptionTopic.class, Substance.class, SubstanceDefinition.class, SupplyDelivery.class, SupplyRequest.class,
      Task.class, TerminologyCapabilities.class, TestReport.class, TestScript.class, ValueSet.class,
      VerificationResult.class, VisionPrescription.class })
  public static final String SP_PATIENT = "patient";
  /**
   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
   * <p>
   * Description: <b>Multiple Resources:
   * 
   * [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
   * [CarePlan](careplan.html): Who the care plan is for
   * [CareTeam](careteam.html): Who care team is for
   * [ClinicalImpression](clinicalimpression.html): Patient or group assessed
   * [Composition](composition.html): Who and/or what the composition is about
   * [Condition](condition.html): Who has the condition? [Consent](consent.html):
   * Who the consent applies to [DetectedIssue](detectedissue.html): Associated
   * patient [DeviceRequest](devicerequest.html): Individual the service is
   * ordered for [DeviceUseStatement](deviceusestatement.html): Search by subject
   * - a patient [DiagnosticReport](diagnosticreport.html): The subject of the
   * report if a patient [DocumentManifest](documentmanifest.html): The subject of
   * the set of documents [DocumentReference](documentreference.html): Who/what is
   * the subject of the document [Encounter](encounter.html): The patient or group
   * present at the encounter [EpisodeOfCare](episodeofcare.html): The patient who
   * is the focus of this episode of care
   * [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to
   * list family member history items for [Flag](flag.html): The identity of a
   * subject to list flags for [Goal](goal.html): Who this goal is intended for
   * [ImagingStudy](imagingstudy.html): Who the study is about
   * [Immunization](immunization.html): The patient for the vaccination record
   * [List](list.html): If all resources have the same subject
   * [MedicationAdministration](medicationadministration.html): The identity of a
   * patient to list administrations for
   * [MedicationDispense](medicationdispense.html): The identity of a patient to
   * list dispenses for [MedicationRequest](medicationrequest.html): Returns
   * prescriptions for a specific patient
   * [MedicationStatement](medicationstatement.html): Returns statements for a
   * specific patient. [NutritionOrder](nutritionorder.html): The identity of the
   * person who requires the diet, formula or nutritional supplement
   * [Observation](observation.html): The subject that the observation is about
   * (if patient) [Procedure](procedure.html): Search by subject - a patient
   * [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
   * [ServiceRequest](servicerequest.html): Search by subject - a patient
   * [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
   * [VisionPrescription](visionprescription.html): The identity of a patient to
   * list dispenses for </b><br>
   * Type: <b>reference</b><br>
   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is
   * Patient) | CareTeam.subject.where(resolve() is Patient) |
   * ClinicalImpression.subject.where(resolve() is Patient) |
   * Composition.subject.where(resolve() is Patient) |
   * Condition.subject.where(resolve() is Patient) | Consent.patient |
   * DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) |
   * DeviceUseStatement.subject.where(resolve() is Patient) |
   * DiagnosticReport.subject.where(resolve() is Patient) |
   * DocumentManifest.subject.where(resolve() is Patient) |
   * DocumentReference.subject.where(resolve() is Patient) |
   * Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient |
   * FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) |
   * Goal.subject.where(resolve() is Patient) |
   * ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient |
   * List.subject.where(resolve() is Patient) |
   * MedicationAdministration.subject.where(resolve() is Patient) |
   * MedicationDispense.subject.where(resolve() is Patient) |
   * MedicationRequest.subject.where(resolve() is Patient) |
   * MedicationStatement.subject.where(resolve() is Patient) |
   * NutritionOrder.patient | Observation.subject.where(resolve() is Patient) |
   * Procedure.subject.where(resolve() is Patient) |
   * RiskAssessment.subject.where(resolve() is Patient) |
   * ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient |
   * VisionPrescription.patient</b><br>
   * </p>
   */
  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
      SP_PATIENT);

  /**
   * Constant for fluent queries to be used to add include statements. Specifies
   * the path value of "<b>List:patient</b>".
   */
  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("List:patient")
      .toLocked();

}
